From: Florian Müllner Date: Tue, 18 Dec 2018 10:20:42 +0000 (+0100) Subject: calendar: Simplify placeholder X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~684^2^2~303 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=8451df977c76af4e9cc232946a8f02ef14bd0071;p=gnome-shell.git calendar: Simplify placeholder Without the events section in the message list, the placeholder can only reflect whether or not there are notifications. https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1282 --- diff --git a/js/ui/calendar.js b/js/ui/calendar.js index 7eb451916..ef3a28240 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -31,10 +31,6 @@ function sameDay(dateA, dateB) { return sameMonth(dateA, dateB) && (dateA.getDate() == dateB.getDate()); } -function isToday(date) { - return sameDay(new Date(), date); -} - function _isWorkDay(date) { /* Translators: Enter 0-6 (Sunday-Saturday) for non-work days. Examples: "0" (Sunday) "6" (Saturday) "06" (Sunday and Saturday). */ let days = C_('calendar-no-work', "06"); @@ -891,41 +887,13 @@ class Placeholder extends St.BoxLayout { super._init({ style_class: 'message-list-placeholder', vertical: true }); this._date = new Date(); - let todayFile = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/no-notifications.svg'); - let otherFile = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/no-events.svg'); - this._todayIcon = new Gio.FileIcon({ file: todayFile }); - this._otherIcon = new Gio.FileIcon({ file: otherFile }); - - this._icon = new St.Icon(); + const file = Gio.File.new_for_uri( + 'resource:///org/gnome/shell/theme/no-notifications.svg'); + this._icon = new St.Icon({ gicon: new Gio.FileIcon({ file }) }); this.add_actor(this._icon); - this._label = new St.Label(); + this._label = new St.Label({ text: _('No Notifications') }); this.add_actor(this._label); - - this._sync(); - } - - setDate(date) { - if (sameDay(this._date, date)) - return; - this._date = date; - this._sync(); - } - - _sync() { - let today = isToday(this._date); - if (today && this._icon.gicon == this._todayIcon) - return; - if (!today && this._icon.gicon == this._otherIcon) - return; - - if (today) { - this._icon.gicon = this._todayIcon; - this._label.text = _("No Notifications"); - } else { - this._icon.gicon = this._otherIcon; - this._label.text = _("No Events"); - } } }); @@ -1064,6 +1032,5 @@ class CalendarMessageList extends St.Widget { setDate(date) { this._sectionList.get_children().forEach(s => s.setDate(date)); - this._placeholder.setDate(date); } });